import React, { Component} from 'react'
import {Form, Row, Col, Steps, Divider, Table, Button, Progress} from "antd";
//客户管理

class OrderForm extends Component {
    componentWillReceiveProps(nextProps) {
        this.setState({
            shopVisible: nextProps.shopVisible
        })
        // !nextProps.orderVisible&&this.props.data
    }
    constructor(props) {
        super(props);
        this.state = {
            columns: [
                {
                    title: '商品名称',
                    dataIndex: 'goodName'
                },
                {
                    title: '商品状态',
                    dataIndex: 'statusName'
                },
                {
                    title: '总体进度',
                    key: 'goodProcess',
                    width:'200px',
                    render: (text, row, index) => (
                        <Progress percent={Number(row.goodProcess)} status="active" />
                    ),
                },
                {
                    title: '操作',
                    dataIndex: 'Action',
                    width: 300,
                    align: 'center',
                    render: (text, row, index) => (
                        <Row gutter={16}>
                            <Col className="gutter-row" span={8}>
                                <Button type="primary"  onClick={() => this.orderDetail(row)}>详情</Button>
                            </Col>
                            <Col className="gutter-row" span={8}>
                                <Button type="primary"  >查看111</Button>
                            </Col>
                        </Row>)
                }
            ],
            tableData:[]
        }
    }
    orderDetail(row){
        this.props.updateParent(true,row.id)
    }
    render() {
        const {data}=this.props
        const { Step } = Steps;
        return (
            <div>
                <div id="orderForm">
                    <Row gutter={16}>
                        <Col className="gutter-row" span={8}>
                            <h3 >订单编号</h3>
                            <div>{data.orderId}</div>
                            <div>{data.createTime}</div>
                        </Col>
                        <Col className="gutter-row" span={16}>
                            <Steps current={data.status=='0'? 0: (data.status=='1' ? 1 : 3)} percent={60}>
                                <Step title="未生产"/>
                                <Step title="生产中"/>
                                <Step title={data.status==2? "已取消" : data.status==4 ? "待修复" : "已完成"}>
                                </Step>
                            </Steps>
                        </Col>
                    </Row>
                    <Divider />
                    <Row gutter={16}>
                        <h3>商品信息</h3>
                        <Table bordered  columns={this.state.columns}  dataSource={data.goodList} pagination={false} rowKey={record => record.id}
                        />
                    </Row>
                </div>

            </div>

        )
    }
}
export default Form.create()(OrderForm);